package com.llc.spring.cloud.eureka.client.configuration;

import javax.servlet.*;
import java.io.IOException;

/**
 * time 2018/8/21 10:27
 *
 * @author xiaojie.zhu <br>
 */
public class LoggerFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println(Thread.currentThread().getName() + " , " + this.hashCode());
        long start = System.currentTimeMillis();
        filterChain.doFilter(servletRequest,servletResponse);
        long now = System.currentTimeMillis();
        System.out.println("用时:" + (now - start));
    }

    @Override
    public void destroy() {


    }
}
